package jackey.tool.tools;

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class HttpClient {

	public static void main(String args[]) {
		
		String data = "username=admin22&password=admin22&autologin=false";
		
		HttpURLConnection con = null;
		//zz@q.com/123456
		try {
			URL url = new URL("https://www.pathofexile.com/login");
			con = (HttpURLConnection) url.openConnection();
			con.setRequestMethod("POST");
			con.setDoOutput(true);
			con.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows 2000)");//模拟IE
//			DataOutputStream dos = new DataOutputStream(con.getOutputStream());
//			dos.write(data.getBytes());
//			dos.flush();
//			dos.close();
			
			BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream()));
			
			String line = null;
			while ((line = br.readLine()) != null) {
				System.out.println(line);
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (con != null) {
				con.disconnect();
				con = null;
			}
		}
		
	}
	
}
